package demo3;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        StringBuffer stringBuffer = new StringBuffer(s);

        StringBuffer stack = new StringBuffer();
        for (int i = 0; i < stringBuffer.length(); i++) {
            char current = stringBuffer.charAt(i);

            //检查当前字符是否与栈顶匹配
            if (stack.length()>0 && stack.charAt(stack.length()-1) == current){
                stack.deleteCharAt(stack.length()-1);
            }else {
                stack.append(current);
            }
        }
        if (stack.length() == 0){
            System.out.println(0);
        }else {
            System.out.println(stack.toString());
        }
    }
}
